package com.ls.pattern.structure.composite;

import java.util.ArrayList;
import java.util.List;

//大学
public class University extends OrganizationComponent {

    //存放学院
    List<OrganizationComponent> collegeList = new ArrayList<>();

    public University(String name, String des) {
        super(name, des);
    }

    @Override
    protected void add(OrganizationComponent organizationComponent) {
        collegeList.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        collegeList.remove(organizationComponent);
    }

    @Override
    protected void print() {
        System.out.println("------------" + getName() + "-----------");
        for (OrganizationComponent component : collegeList) {
            component.print();
        }
    }
}
